package com.ruoyi.project.sms.service;

import java.time.LocalDateTime;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.db.sms.mapper.SmsTopicMapper;
import com.ruoyi.db.sms.domain.SmsTopic;
import com.ruoyi.db.sms.domain.query.SmsTopicQueryVo;

/**
 * 推荐专题Service业务层处理
 *
 * @author yfy
 * @date 2020-04-20
 */
@Service
public class SmsTopicService
{
    @Autowired
    private SmsTopicMapper smsTopicMapper;

    /**
     * 查询推荐专题
     *
     * @param id 推荐专题ID
     * @return 推荐专题
     */
    public SmsTopic selectSmsTopicById(Long id)
    {
        return smsTopicMapper.selectSmsTopicById(id);
    }

    /**
     * 查询推荐专题列表
     *
     * @param smsTopicQueryVo 推荐专题查询参数
     * @return 推荐专题
     */
    public List<SmsTopic> selectSmsTopicList(SmsTopicQueryVo smsTopicQueryVo)
    {
        return smsTopicMapper.selectSmsTopicList(smsTopicQueryVo);
    }

    /**
     * 新增推荐专题
     *
     * @param smsTopic 推荐专题
     * @return 结果
     */
    public int insertSmsTopic(SmsTopic smsTopic)
    {
        smsTopic.setAddTime(DateUtils.getNowDate());
        return smsTopicMapper.insertSmsTopic(smsTopic);
    }

    /**
     * 修改推荐专题
     *
     * @param smsTopic 推荐专题
     * @return 结果
     */
    public int updateSmsTopic(SmsTopic smsTopic)
    {
        smsTopic.setUpdateTime(LocalDateTime.now());
        return smsTopicMapper.updateSmsTopic(smsTopic);
    }

    /**
     * 批量删除推荐专题
     *
     * @param ids 需要删除的推荐专题ID
     * @return 结果
     */
    public int deleteSmsTopicByIds(Long[] ids)
    {
        return smsTopicMapper.deleteSmsTopicByIds(ids);
    }

    /**
     * 删除推荐专题信息
     *
     * @param id 推荐专题ID
     * @return 结果
     */
    public int deleteSmsTopicById(Long id)
    {
        return smsTopicMapper.deleteSmsTopicById(id);
    }
}
